Review


Problem 1
Write a program called SentenceAnalysis to create a report about a line of text as shown.
Escriba un programa llamado SentenceAnalysis que cree un reporte sobre una línea de texto como se muestra.

SentenceAnalysis.h
#pragma once //______________________________________ SentenceAnalysis.h
#include "resource.h"

class SentenceAnalysis: public Win::Dialog
{
public:
     SentenceAnalysis()
     {
     }
     ~SentenceAnalysis()
     {
     }
     bool IsLetter(wchar_t character);
     bool IsNumber(wchar_t character);
     bool IsSign(wchar_t character);
protected:
     ...
};

SentenceAnalysis.cpp
void SentenceAnalysis::Window_Open(Win::Event& e)
{
}

void SentenceAnalysis::btReport_Click(Win::Event& e)
{
     wstring input = tbxInput.Text;
     const int len = input.length();
     int numLetters = 0;
     ...
     for(int i = 0; i<len; i++)
     {
          if (IsLetter(input[i])== true) numLetters++;
     }
     ...
}

// Any character from A to Z and from a to z
bool SentenceAnalysis::IsLetter(wchar_t character)
{
}

// Any character from 0 to 9
bool SentenceAnalysis::IsNumber(wchar_t character)
{
}

// Any character that is not a letter, a number nor a space
bool SentenceAnalysis::IsSign(wchar_t character)
{
}

SentenceAnalysis

Problem 2
Write a program called Hidden to find the count and position of the letter small s.
Escriba un programa llamado Hidden para encontrar el número y posición de la letra s minúscula.

Hidden.h
#pragma once //______________________________________ Hidden.h
#include "resource.h"

class Hidden: public Win::Dialog
{
public:
     Hidden()
     {
     }
     ~Hidden()
     {
     }
     int CharacterCount(wstring inputText, wchar_t character);
     int CharacterPosition(wstring inputText, wchar_t character);
protected:
     . . .
};

Hidden.cpp
void Hidden::Window_Open(Win::Event& e)
{
}

void Hidden::tbxInput_Change(Win::Event& e)
{
     wstring input = tbxInput.Text;
     tbxCount.IntValue = CharacterCount(input, 's');
     tbxPosition.IntValue = CharacterPosition(input, 's');
}

// Returns the number of occurrences of the character in the input text
int Hidden::CharacterCount(wstring inputText, wchar_t character)
{
}

// Returns the position of the first occurrence of the character in the input text
// Returns -1, if the character is not found
int Hidden::CharacterPosition(wstring inputText, wchar_t character)
{
}

Hidden1

Hidden2

Hidden3

© Copyright 2000-2021 Wintempla selo. All Rights Reserved. Jul 22 2021. Home